#!/usr/bin/perl -w
print "Content-type:text/html\n";

$name = "$ARGV[0]";   # pass argument from php to perl code
$value = "Error: Info not found!";   # initializing value

open $file, "<", "../conf/OrganizationInfo.txt" or $value = "Error: OrganizationInfo.txt not found!";

if ($value =~ "Error: Info not found!") {
while ($line = <$file>) {   # checks all lines in file

        if($line =~ 
	/^\s*$name\s*=\s*
	(([+|-]?\d+(\.\d)?)|
	\"(.+)\"|
	\'(.+)\')
	\s*(\#.*)?$/x) 
	{
			if($2) { $value = $2; }
			if($4) { $value = $4; }
			if($5) { $value = $5; }
	}
}
}

$value =~ s/\"/\\\"/g;
$value =~ s/\'/\\\'/g;

print $value."\n";

close $file;

exit(5);
